"""
 encoding    : utf-8
 @File       : login.py
 @Author     : qin
 @Version    :
 @Description:
 @Date       : 2024/07/10
"""
from selenium.webdriver import Keys


class Login:
    def __init__(self,driver):
        self.driver = driver

    def open_web(self,url):
        self.driver.get(url)

    def login(self,uname,pwd,mark_num):
        #定位用户名文本框
        self.driver.find_element('xpath','//*[@id="account"]/input').send_keys(uname)
        #定位密码文本框
        self.driver.find_element('xpath','//*[@id="password"]/input').send_keys(pwd)
        #定位验证码文本框
        self.driver.find_element('xpath','//*[@id="authCode"]/div/input').send_keys(mark_num)
        #定位登录按钮
        self.driver.find_element('xpath','//*[@id="root"]/div/div[1]/form/div[5]/div/div/span/button').click()

    def logout(self):
        self.driver.close()
